package com.neusoft.mapper;

import com.neusoft.po.PointLog;
import com.neusoft.po.PointTrans;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PointMapper {
    @Insert("insert into pointLog values(null, #{userId},1, #{time})")
    public int savePointLogByPay(PointLog pointLog);

    @Select("select count(*) from pointLog where userId = #{userId} and state = 1")
    public int getPointLogByUserIdByTime(String userId);

    public int deletePointLogByUserIdByTime(@Param("userId") String userId, @Param("count") int count);

    @Delete("delete from pointLog where time < #{limitTime} and userId = #{userId}")
    public int updatePointLog(String userId, String limitTime);

    @Select("select count(*) from pointLog where userId = #{userId} and time = #{limitTime}")
    public int getExpirationPointLogByUserId(@Param("userId") String userId, @Param("limitTime") String limitTime);

    @Insert("insert into pointTrans values(null, #{userId}, #{type}, #{count}, #{time})")
    public int savePointTrans(PointTrans pointTrans);

    public List<PointTrans> listPointTransByUserId(String userId);
}
